|
|
|
| Setting Captions for Each Field 1. Click each field in the Command object, right-click and select the Properties menu. 2. Set the Caption property to a nice descriptive name for each field. |  | Setting the Caption property will generate nice label names if you drag and drop this command object onto a form. |
|
|
|
|
|
|
Using the Connection and Command Objects at Runtime |
|
|
|
|
|
|
|
|
Now that you have a Connection object and a Command object, you can use these objects in your source code. About the only things you can do with the Connection object are open it, close it, and execute a SQL INSERT, UPDATE, or DELETE statement. However, when you add a Command object, the data environment will automatically build a recordset based on that Command object. Here are two different methods for opening the Connection object thats attached to the data environment and using the Command object to fetch some data: |
|
|
|
 |
|
|
|
|
Private Sub cmdTest_Click()
denvEmployees.cnEmp.Open
' Do some processing
With denvEmployees.rscmdEmployee
.Open
Do Until .EOF
Debug.Print .Fields("szLast_nm")
.MoveNext
Loop
.Close
End With
denvEmployees.cnEmp.Close
End Sub |
|
|
|
|
|